var cbgnum = 0; 
var maker = 0; //0为制作，1为浏览

function getpichw(url) {
	var realWidth;
	var realHeight;
	$("<img/>").attr("src", url).load(function() {
		realWidth = this.width;
		realHeight = this.height;
	});
}

$(".cbg").click(function() {
	 if(cbgnum == 0) {
 	$("#skinpreview").css("background-image", "url(http://ogv6oecb7.bkt.clouddn.com/17-2-9/16693878-file_1486646855063_5ee8.png)");
 	cbgnum = 1;
 	return;
 }
 if(cbgnum == 1) {
 	$("#skinpreview").css("background-image", "url(http://ogv6oecb7.bkt.clouddn.com/17-2-9/57299938-file_1486650635640_747f.jpg)");
 	cbgnum = 2;
 	return;
 }
 if(cbgnum == 2) {
 	$("#skinpreview").css("background-image", "url(http://ogv6oecb7.bkt.clouddn.com/17-2-10/24646706-file_1486684213993_120e.png)");
 	cbgnum = 3;
 	return;
 }
 if(cbgnum == 3) {
 	$("#skinpreview").css("background-image", "");
 	cbgnum = 0;
 	return;
 }
});


$("#to-make").click(function() {
	if(maker == 0) {
		$(".viewer").hide();
		$(".maker").fadeIn();
		$("#to-make").attr("class", "active");
		$("#to-view").attr("class", "");
		windowssize1();
		maker = 1;

	} else {
		alert("当前为制作状态！")
	}
});

$("#to-view").click(function() {
	if(maker == 1) {
		$(".maker").hide();
		$(".viewer").fadeIn();
		$("#to-make").attr("class", "");
		$("#to-view").attr("class", "active");
		windowssize1();
		maker = 0;

	} else {
		alert("当前为浏览状态！")
	}
});

$("#new-skin").click(function() {
	alert("功能正在制作");
});


particlesJS('pagebg', {
  particles: {
    color: '#605ca8',
    shape: 'circle',
    opacity: 1,
    size: 1,
    size_random: false,
    nb: 50,
    line_linked: {
      enable_auto: true,
      distance: 100,
      color: '#605ca8',
      opacity: 1,
      width: 1,
      condensed_mode: {
        enable: false,
        rotateX: 600,
        rotateY: 600
      }
    },
    anim: {
      enable: true,
      speed: 4
    }
  },
  interactivity: {
    enable: true,
    mouse: {
      distance: 300
    },
    detect_on: 'canvas', 
    mode: 'grab',
    line_linked: {
      opacity: .5
    },
    events: {
      onclick: {
        enable: true,
        mode: 'push', 
        nb: 4
      }
    }
  },

  retina_detect: true
});
